﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml;
using System.Xml;

namespace Inovout.Office.Excel
{
    public class ExcelDocument:IDisposable
    {
        private SpreadsheetDocument spreadsheetDocument;
        public ExcelDocument(string excelTemplageFileName)
        {
            spreadsheetDocument = SpreadsheetDocument.Open(excelTemplageFileName, false);
            //System.IO.Packaging.Package
        }

        protected XmlReader GetXmlByUri(Uri xmlUri)
        {
            return new System.Xml.XmlTextReader(spreadsheetDocument.Package.GetPart(xmlUri).GetStream());
        }

        public void Dispose()
        {
            spreadsheetDocument.Dispose();
        }
    }
}

